package com.test.baoxiudemo.battery;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.text.TextUtils;
import android.util.Log;

public class MyBroadcastReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
//		if(TextUtils.isEmpty(action) && action.equalsIgnoreCase(Intent.ACTION_BATTERY_CHANGED)){
//			
//		}
//
////		IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
////		Intent battery = context.registerReceiver(null, ifilter);
//		int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
//		int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
//		float batteryPct = level / (float) scale;
//		Log.d("fbb", "level:" + level + "|" + "scale:" + scale + "|"
//				+ "batteryPct:" + batteryPct + "|");
	}

}
